package langchain4j.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import langchain4j.bean.Appointment;
import langchain4j.entity.Department;
import langchain4j.entity.Doctor;
import langchain4j.entity.DoctorSchedule;
import langchain4j.mapper.AppointmentMapper;
import langchain4j.mapper.DoctorMapper;
import langchain4j.service.AppointmentService;
import langchain4j.service.DoctorService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;


    public List<Doctor> selectDoctorListByPage(int offset, int size, String name, String title, String department) {
        return doctorMapper.selectDoctorListByPage(offset, size, name, title, department);
    }

    @Override
    public int countDoctorList(String name, String title,String department) {
        return doctorMapper.countDoctorList(name,title,department);
    }

    @Override
    public List<Doctor> getDoctorsByDepartmentId(Integer id) {
            if (id == null) {
                throw new IllegalArgumentException("科室ID为空");
            }

        LambdaQueryWrapper<Doctor> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Doctor::getDepartmentId,id);
        return doctorMapper.selectList(queryWrapper);
    }

    @Override
    public List<DoctorSchedule> getDoctorSchedule(String doctorName) {
        return doctorMapper.getDoctorSchedule(doctorName);
    }


}
